package com.meida.module.bus.client.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * redisKey类型
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum RedisKeyEnum {
    airportViproom("guibinting:viproomType1:weChatId:", "机场贵宾厅"),
    highSpeedTrainViproom("guibinting:viproomType2:weChatId:", "高铁贵宾厅"),
    airportViponly("guibinting:viponly:weChatId:", "机场贵宾通道"),
    userGoodsCode("UserGoodsCode:", "用户物品二维码"),
    busConfig("busConfig:", "首页图文配置");

    RedisKeyEnum(String redisKey, String desc) {
        this.redisKey = redisKey;
        this.desc = desc;
    }

    @EnumValue
    private final String redisKey;
    private final String desc;

    public String getRedisKey() {
        return redisKey;
    }

    public String getDesc() {
        return desc;
    }

    public static RedisKeyEnum getByValue(String code) {
        for (RedisKeyEnum redisKeyEnum : values()) {
            if (code.equals(redisKeyEnum.getRedisKey())) {
                return redisKeyEnum;
            }
        }
        return null;
    }
}
